﻿//------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Xml;
using System.Text;

namespace Microsoft.ResourceManagement.Samples.ResourceManagementClient.ExtensionIdentityManagementOperations
{
    [XmlRoot(ElementName = "BaseObjectSearchResponse", Namespace = Constants.NamespaceDirectoryAccess)]
    public class BaseObjectSearchResponse
    {
        private List<PartialAttribute> partialAttributes;
        public BaseObjectSearchResponse()
        {
            this.partialAttributes = new List<PartialAttribute>();
        }
        
        // List so serializer can add elements
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly"), XmlElement(ElementName = "PartialAttribute")]
        public List<PartialAttribute> PartialAttributes
        {
            get
            {
                return this.partialAttributes;
            }
            set
            {
                this.partialAttributes = value;
            }
        }
    }

    // Partial Attribute is the name of the XML Element
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
    public class PartialAttribute
    {
        private List<XmlNode> values;

        public PartialAttribute()
        {
            this.values = new List<XmlNode>();
        }
        
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly"), XmlAnyElement(Namespace = Constants.NamespaceDirectoryAccess)]
        public List<XmlNode> Values
        {
            get
            {
                return this.values;
            }
            set
            {
                this.values = value;
            }
        }
    }
}
